<template>
	
	<div class="main-content">
		<span class="span-title">个人信息</span>
		<h1 class="page-header">
			<div>账户：<strong>{{userInfo.userPhone}}</strong></div>
			<div>姓名：<strong>{{userInfo.userName}}</strong></div>
		</h1>
		<div class="table-responsive report-table">
			<span class="span-title">驻守楼盘</span>
			<table class="table table-striped table-bordered min-width-1060">
				<thead>
					<tr>
						<th width="10%">序号</th>
						<th width="10%">楼盘名称</th>
						<th width="10%">审核状态</th>
						<th width="15%">项目经理</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(row, index) in pageList">
						<td v-if="params.pageNo==1">{{index + 1}}</td>
						<td v-if="params.pageNo>1">{{(params.pageNo-1)*params.pageSize + index + 1}}</td>
						<td>{{row.name}}</td>
						<td>{{row.premisesStatusName}}</td>
						<td>{{row.manager}}</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div id="laypage_div"></div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {
					userName: window.localStorage.getItem("1_userName"),
					userPhone:window.localStorage.getItem("1_userPhone")
				},
				params: {
					pageSize: 5,
					pageNo: 1
				},
				pageList: []
			}
		},
		mounted: function() {
			this.getCaseMemberPage();
		},
		methods:{
			getCaseMemberPage() {
				var _self = this;
				var body = {};
				var params = _self.params;
				body.params = params;
				var url = _self.utilHelper.apiUrl + "/api/getCaseMemberPage";
				this.$http.post(url, body).then((response) => {
					var result = response.body.result;
					if(result == "1") {
						var resData = response.body.resData;
						var caseMemberPage = resData.data;
						var caseMemberRows = caseMemberPage.rows;
						_self.pageList = caseMemberRows;
						var current = caseMemberPage.pageNumber;
						var total = caseMemberPage.total;
						if (total > 0) {
							//加载分页组件
							layui.laypage.render({
								elem: $('#laypage_div'), //容器。值支持id名、原生dom对象，jquery对象,
								limit:_self.params.pageSize,
								curr:current,
								count:total,
								theme: '#f87242;', //皮肤
								first: '首页', //若不显示，设置false即可
								last: '尾页', //若不显示，设置false即可
								prev: '上一页', //若不显示，设置false即可
								next: '下一页', //若不显示，设置false即可
								layout:['prev', 'page', 'next','skip','count'],
								jump: function(obj, first) {
									if(!first) {
										_self.params.pageNo = obj.curr;
										_self.getCaseMemberPage();
									}
								}
							});
						}
					}
				}, (response) => {
					console.log(response);
				});
			}
		}
	}
</script>
<style type="text/css" scoped>
	.span-title{display: inline-block;padding:10px 0 10px 0;font-size: 15px;font-weight: bold;}
</style>
